Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial selectorified API #2567

Closed
wants to merge 2 commits into from
Closed

Initial selectorified API #2567

wants to merge 2 commits into from

Conversation

Fizzixnerd
Copy link
Contributor

@Fizzixnerd Fizzixnerd commented Sep 18, 2024

I have here a skeleton API for a selectorified API. This begins to address #2543 and #2545 (Perhaps? Comments?) by switching from the API used in o1vm/src/mips/interpreter.rs to that detailed in o1vmsrc/mips/singlestep.rs.

The main changes are:

  • No use of mutability, instead using the "generator style" of a -> State -> (b, State)
  • Significantly pared down API, will likely add to it as I realize it was needed, but for now start small!
  • Instructions now "know" their arguments, by packing them in the enum fields with them. This allows the generator style to uniformly look like Instructions -> State -> (Witness, State) and for witness generation, without having to worry about different arities and register arguments. [Of course, the old instructions with their arguments can be relatively easily converted to this form -- to come].
  • A small example of the API in use is below the API with a couple of test curves and an example instruction-set based on a significantly simplified MIPS instruction set, using just one of each of a small class of instructions, for parallel debugging and sanity-checking purposes.
  • Simplified register set, again for debugging and sanity-checking
  • Simplified ExampleS previously an implementor of InterpreterEnv (Env in witness.rs and the like) which will almost surely grow as the number of instructions returns to parity.

The point of these changes is to provide a basic test-bed for the selector changes to come.

@Fizzixnerd Fizzixnerd added the enhancement New feature or request label Sep 18, 2024
@Fizzixnerd Fizzixnerd self-assigned this Sep 18, 2024
Copy link
Contributor

@marcbeunardeau88 marcbeunardeau88 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


pub type ExamplePosition = column::ColumnAlias;

pub type ExampleVariable = ark_bn254::Bn254;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that variables are a way to index to positions in the plonk matrix.
Therfore, I would use something like unsigned integer, but not a crypto related object

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I changed to unsigned integer in the latest version.

Regarding the from-scratch approach shown here, this is mostly a playground where I can test out ideas which I will then port back to the regular interpreter, I think, without the full complexity of the regular interpreter. It didn't start out as that, mind you!

But I think you and Danny are right.

@dannywillems
Copy link
Member

As discussed in PM, I would simply use an "iter" on the instructions with the constraint environment, multiplying by a selector, adding constraints on them on the way.
The selectors are added to a witness structure/proof structure. I'm not sure that we need a new trait.

@dannywillems
Copy link
Member

C.f Arrabiata

@Fizzixnerd
Copy link
Contributor Author

Closing as I decided on another approach.

@Fizzixnerd Fizzixnerd closed this Sep 20, 2024
@Fizzixnerd Fizzixnerd deleted the fizzixnerd/selectors-0 branch September 20, 2024 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants